<template>
	<view class="container setorder">
		<myhead :title="mytitle" class="myhead"></myhead>
		<view class="mian">
			<view class="left">
				<view class="title">
					批次列表
				</view>
				<view class="batchlist">
					<view class="top" @tap = "selectall" :class="{active:ins==-1}">
						<image 
						src="../../static/images/batchicon.png" 
						class="batchicon">
						</image>
						<view class="text">
							全部</br>批次
						</view>
					</view>
					<scroll-view class="listbox" scroll-y="true">
						<view class="item" v-for="(item,index) in 30" :key = "index" @tap = "select(index)" :class="{active:index==ins}">
							<view class="time">
								211004
							</view>
							<view class="name">
								货源a
							</view>
						</view>
					</scroll-view>
				</view>
				<navigator class="addbatch" url="../addbatch/addbatch">
					<image 
					class="batchicon"
					src="../../static/images/antFill-shop@2x.png"></image>
					<view class="text">新增批次</view>
				</navigator>
			</view>
			<view class="right">
				<navigator class="usertop" url="../selectuser/selectuser">
					<view class="username">
						客户：临时客户
					</view>
					<image src="../../static/images/blackright.png" class="myicon routericon"></image>
				</navigator>
				<view class="addbatch" @tap = "addbatch">
					<image src="../../static/images/add.png" class="addbatchicon"></image>
					<view class="text">
						添加本批次商品
					</view>
				</view>
				<scroll-view class="productlist" scroll-y="true">
					<view class="item" v-for="(item,index) in 4" :key="index">
						<view class="top">
							<view class="productname">
								八爪鱼
							</view>
							<view class="productsales">
								35元/斤
							</view>
						</view>
						<view class="footer">
							
						</view>
					</view>
				</scroll-view>
			</view>
			<view class="cover" @tap = "addbatch" v-if="addbatchflag"></view>
			<chooseproducts class="mychooseproducts" v-if="addbatchflag"></chooseproducts>
		</view>
		<view class="footer">
			<view class="total">
				<image 
				src="../../static/images/shopcar.png" 
				class="totalicon">
				</image>
				<view class="num">
					<view class="text">
						合计：
					</view>
					<view class="money">
						210
					</view>
					<view class="text">
						元
					</view>
				</view>
			</view>
			<navigator class="decide" url="../shopcar/shopcar">
				(1种)选好了
			</navigator>
		</view>
		
	</view>
</template>

<script>
	import myhead from "../../components/header/header.vue"
	import chooseproducts from "../../components/chooseproducts/chooseproducts.vue"
	export default {
		data() {
			return {
				mytitle:'开单',
				ins:0,
				addbatchflag:false
			};
		},
		methods:{
			addbatch(){
				this.addbatchflag = !this.addbatchflag;
			},
			select(index){
				this.ins = index
			},
			selectall(){
				this.ins = -1;
			}
		},
		components:{
			myhead,
			chooseproducts
		}
	}
</script>

<style lang="scss" scoped>
	.setorder{
		display: flex;
		// position: relative;
		flex-direction: column;
		color: black;
		.myhead{
			z-index: 800;
		}
		.mian{
			flex: 1;
			display: flex;
			background-color: #EEEEEE;
			overflow: hidden;
			position: relative;
			.left{
				width: 22%;
				height: 100%;
				background-color: #FFFFFF;
				box-sizing: border-box;
				display: flex;
				flex-direction: column;
				.title{
					text-align: center;
					padding: 20rpx;
					white-space: nowrap;
					font-size: 30rpx;
				}
				.batchlist{
					width: 100%;
					flex: 1;
					display: flex;
					overflow: hidden;
					flex-direction: column;
					.top{
						display: flex;
						justify-content: flex-start;
						align-items: center;
						padding-left: 28rpx;
						padding-top: 20rpx;
						padding-bottom: 20rpx;
						.batchicon{
							width: 48rpx;
							height: 48rpx;
							margin-right: 10rpx;
						}
						.text{
							font-size: 24rpx;
						}
						&.active{
							background-color: #EEEEEE;
						}
					}
					.listbox{
						flex: 1;
						overflow: hidden;
					}
					.item{
						font-size: 24rpx;
						padding-left: 30rpx;
						padding-top: 15rpx;
						padding-bottom: 15rpx;
						&.active{
							background-color: #EEEEEE;
						}
						.name{
							overflow: hidden;
							white-space: nowrap;
							text-overflow: ellipsis;
						}
					}
				}
				.addbatch{
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					background-color: rgba(255,196,0,0.5);
					padding: 20rpx 0;
					.batchicon{
						width: 48rpx;
						height: 48rpx;
					}
					.text{
						font-size: 24rpx;
					}
				}
			}
			.right{
				padding: 2rpx;
				flex: 1;
				display: flex;
				flex-direction: column;
				.usertop{
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 30rpx 20rpx;
					background-color: #FFFFFF;
					.username{
						font-weight: bold;
						font-size: 34rpx;
					}
				}
				.addbatch{
					margin-top: 4rpx;
					display: flex;
					align-items: center;
					background-color: #FFFFFF;
					padding: 10rpx 20rpx;
					.addbatchicon{
						width: 42rpx;
						height: 42rpx;
						margin-right: 10rpx;
					}
					.text{
						font-size: 26rpx;
						color: #34C758;
						font-weight: bold;
					}
				}
				.productlist{
					flex: 1;
					width: 100%;
					padding: 20rpx;
					box-sizing: border-box;
					overflow: hidden;
					.item{
						background-color: #FFFFFF;
						border-radius: 16rpx;
						padding: 40rpx 20rpx;
						margin-bottom: 20rpx;
						.top{
							display: flex;
							align-items: center;
							justify-content: space-between;
							.productname{
								font-size: 36rpx;
								font-weight: bold;
							}
							.productsales{
								font-size: 24rpx;
								color: gray;
							}
						}
					}
				}
			}
		}
		>.footer{
			z-index: 700;
			padding: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			background-color: #FFFFFF;
			.total{
				display: flex;
				align-items: center;
				.totalicon{
					width: 50rpx;
					height: 50rpx;
					margin-right: 20rpx;
				}
				.num{
					display: flex;
					align-items: center;
					font-size: 24rpx;
					.money{
						color: red;
					}
				}
			}
			.decide{
				width: 30%;
				text-align: center;
				font-weight: bold;
				padding: 10rpx;
				font-size: 30rpx;
				white-space: nowrap;
				border-radius: 10%;
				color: #FFFFFF;
				background-color: #34C758;
			}
		}
		.cover{
			position: absolute;
			top: 0;
			bottom: 0;
			width: 100%;
			background-color: rgba(0,0,0,0.5);
			z-index: 400;
		}
		.mychooseproducts{
			position: absolute;
			left: 0;
			width: 100%;
			bottom: 0;
			z-index: 500;
		}
	}

</style>
